#pragma once
#include <mutex>
#include <Python.h>
#include <atomic>
#include <memory>
#include "rustnum.h"
class pyhashmap {
public:
	pyhashmap(double cacheg, double secg,double autoh, const char* filename);
	pyhashmap(char* filename);
	~pyhashmap();
	void add(PyObject*);
	bool check(PyObject*);
	void save();
	unsigned long long hashfunc(PyObject*);
	void remove(PyObject*);
private:
	inline void autosave();
	void init();
	std::pair<unsigned long long, unsigned long long> hashnumfunc(unsigned long long hashn);
	unsigned long long mapnum;
	unsigned long long hashnum;
	unsigned long long cachebyte;
	char* filename;
	double autoh;
	std::mutex savelock;
	std::atomic<bool> threadsign = false;
	std::atomic<bool> deletesign = false;
	Vec<Arc<SecondNum>>* rustmapfile;
};